<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib prefix="s" uri="/struts-tags" %>

<div>Attributes</div><br/>
<div>${msg}
${errorMsg}</div><br/>

<script type="text/javascript">
	function dis()
	{
		if(document.getElementById('newAttribute').style.display=='block')
		{
			document.getElementById('newAttribute').style.display='none';
		}
		else
		{
			document.getElementById('newAttribute').style.display='block';
		}
	}
</script>

<div id="newAttribute" style="display:none">
	<form method="post" name="createAttribute" action="createAttribute">
		<table>
			<tr><td>Name</td><td><input type="text" name="attribute.name"></td></tr>
			<tr><td>Multivalued</td><td><select name="attribute.multivalued"><option value="true">true</option><option value="false">false</option></select></td></tr>
			<tr><td></td><td><input type="hidden" name="p" value="${p}"><input type="submit" value="Create"><input type="button" value="Cancel" onclick="dis()"></td></tr>
		</table>
	</form>
</div>

<a href="#" onclick="dis()">New Attribute</a>
<table>
<tr><td>Id</td><td>Name</td><td>Multivalued</td><td>Edit</td></tr>
<s:if test="attributes.size() > 0">
	<s:iterator value="attributes" var="attribute">
		<tr>
			<td>			
				<s:if test="multivalued == true">		
					<a href="editAttribute?uuid=${attribute.uuid}&p=${p}">${attribute.uuid}</a>
				</s:if>
				<s:else>
					${attribute.uuid}
				</s:else>
			</td>
			<td>${attribute.name}</td><td><s:property value="multivalued" /></td>
			<td>
				<s:if test="multivalued == true">
				<a href="editAttribute?uuid=${attribute.uuid}&p=${p}">Edit</a>
				</s:if>
				<s:else>
					Edit
				</s:else>
			</td>
		</tr>
	</s:iterator>
</s:if>
</table>

<s:iterator value="pageHtml" var="link">
	<a href="attributes?p=${link}">${link}</a>
</s:iterator>